#ifndef LOMREFCOUNTEDHH
#define LOMREFCOUNTEDHH
#include "lom-typedefs.hh"

namespace lom
{    
    class LomRefCounted
    {
	licada::int32 refcount;
    public:
	LomRefCounted() : refcount( 0 ){}
	virtual ~LomRefCounted(){}
	virtual void addRef() { ++refcount; }
	//Default behavior is to delete this object.  You may instead want to
	//recycle this object in which case you will want to override this
	//method and do something different.
	virtual void removeRef() { --refcount; if ( refcount <= 0 ) delete this; }
	licada::int32 getRefCount() const { return refcount; }
    };
}
#endif
